how to solve print the elements of a linked list